CORELIB_NAME=libpland.so
CORELIB_FILES=src/coreexeption.cpp src/coreutil.cpp src/coredataunit.cpp src/coreplugin.cpp src/coreqmanager.cpp src/coreploader.cpp src/coresettings.cpp src/coresplitter.cpp src/corechain.cpp
CORELIB_OBJECTS	= $(CORELIB_FILES:src/%.cpp=%.o)

CORELIB_COMPILE_FLAGS= -rdynamic -Wall -fPIC -O2 -I../tinyxml/
CORELIB_LIBS= -ltinyxml  -L../build -lboost_thread -ldl
CORELIB_LINK_FLAGS= -shared -Wl,-soname,$(CORELIB_NAME) $(CORELIB_LIBS) -o $(CORELIB_NAME) -rdynamic
CPP=g++
MAKE=make

all: slib

system: slib
	cp $(CORELIB_NAME) ../build/

%.o: src/%.cpp
	$(CPP) $(CORELIB_COMPILE_FLAGS) -c -o $@  $< $(CXXFLAGS)

slib: $(CORELIB_OBJECTS)
	$(CPP) $(CORELIB_LINK_FLAGS) $(CORELIB_OBJECTS)

docs:
	rm -rf doc/
	doxygen doxyfile.cfg
	cd doc/latex/; $(MAKE); mv refman.pdf ../libpland.pdf
	rm -rf doc/latex

.PHONY	: clean open

clean:
	rm -rf $(CORELIB_OBJECTS) $(CORELIB_NAME) doc/ testbench log.txt

open:
	geany  src/*.cpp lib/*.hpp &

test:  $(CORELIB_OBJECTS) main.cpp
	g++ main.cpp -Wl,--rpath,. $(CORELIB_OBJECTS) $(CORELIB_LIBS) -o testbench
